<template>
<div>
  <nav-bar>
    <div slot="center" class="titile">
      <div v-for="(item,index) in titile" :key="item.index" class="titileItem" :class="{active:currentIndex==index}" @click="titilClick(index)">{{item}}</div>
    </div>
    <div slot="left" class="back" @click="backClick">
      <img src="~assets/img/common/back.svg" alt />
    </div>
  </nav-bar>
</div>
</template>

<script>
import NavBar from 'components/common/navbar/NavBar'
export default {
  name: 'DetailNavBar',
  data() {
    return {
      titile: ['商品', '详情', '评论', '推荐'],
      currentIndex: 0,
    }
  },
  methods: {
    titilClick(index) {
      this.currentIndex = index
    },
    backClick() {
      this.$router.back()
    },
  },
  components: {
    NavBar,
  },
}
</script>

<style scoped>
.titile {
  display: flex;
  font-size: 13px;
}

.titileItem {
  flex: 1;
}

.active {
  color: #ff8198;
}

.back img {
  margin-top: 12px;
}
</style>
